home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-05 | 2.5 KB | 94 lines | [TEXT/KAHL] |
- //____________________________________________________________
- // MovieUtilities.c
- //
- // Copyright © Dan Parks Sydow, 1995
- // From the book:
- // "Graphics and Sound Programming Techniques for the Mac",
- // M&T Books, 1995
-
-
- //____________________________________________________________
-
- #include <Movies.h>
-
- #include "Defines.h"
- #include "DataTypes.h"
- #include "Globals.h"
- #include "WindRecordAccess.h"
- #include "MovieUtilities.h"
-
-
- //____________________________________________________________
-
- Boolean UpdateAllOpenMovies( EventRecord theEvent )
- {
- int i;
- WindowPtr theWindow;
- WindowPeek theWindPeek;
- MovieController theController;
- Boolean eventWasHandled;
-
- theWindow = FrontWindow();
-
- for (i = 0; i < gWindowCount; i++)
- {
- if ( GetWindowType( theWindow ) == kMovieWindowType )
- {
- theController = GetWindowController( theWindow );
- eventWasHandled = MCIsPlayerEvent( theController, &theEvent);
- if ( eventWasHandled == 1 )
- return ( true );
- }
- theWindPeek = ((WindowPeek)theWindow)->nextWindow;
- theWindow = (WindowPtr)theWindPeek;
- }
- return ( false );
- }
-
-
- //____________________________________________________________
-
- void CloseMovieAndFile( WindowPtr theWindow )
- {
- MovieController theController;
- Movie theMovie;
- short theFileRefNum;
-
- theFileRefNum = GetWindowFileReference( theWindow );
- CloseMovieFile( theFileRefNum );
-
- theController = GetWindowController( theWindow );
- DisposeMovieController( theController );
-
- theMovie = GetWindowMovie( theWindow );
- DisposeMovie( theMovie );
-
- DisposeWindow( theWindow );
-
- --gWindowCount;
- }
-
-
- //____________________________________________________________
-
- pascal Boolean SizeChangeMCActionFilter( MovieController theController,
- short theAction,
- void *theParams,
- long theRefCon )
- {
- Rect theBoundsRect;
- short theWidth;
- short theHeight;
-
- switch ( theAction )
- {
- case mcActionControllerSizeChanged:
- MCGetControllerBoundsRect( theController, &theBoundsRect );
- theWidth = theBoundsRect.right - theBoundsRect.left;
- theHeight = theBoundsRect.bottom - theBoundsRect.top;
- SizeWindow( (WindowPtr)theRefCon, theWidth, theHeight, true );
- break;
- }
- return false;
- }
-